package cn.com.open.itembank.logic.questiontype;

import cn.com.open.itembank.dto.QuestionImportModel;

/**
 * Created by lucky on 2017/12/19.
 */
public class MultipleChoiceItem extends BaseChoiceItem {
    /**
     * Instantiates a new Multiple choice item.
     *
     * @param model the model
     */
    public MultipleChoiceItem(QuestionImportModel model) {
        super(model);
    }

    //region 校验答案格式

    /**
     * 校验答案格式.
     *
     * @return the boolean
     */
    @Override
    protected boolean checkAnswerFormat() {
        boolean result = true;

        for (String item : importModel.getAnswer()) {
            if (answerIdList.indexOf(item.trim().toUpperCase()) < 0) {
                importModel.setErrorInfo("答案格式不正确；");
                result = false;
                break;
            }
        }

        return result;
    }
    //endregion
}
